package org.example.yiyu.config;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.example.yiyu.util.DiaryInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Slf4j
@Configuration//配置类
@RequiredArgsConstructor
public class DiaryConfig implements WebMvcConfigurer {

    private final DiaryInterceptor diaryInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(diaryInterceptor).addPathPatterns("/diary/**")
                .addPathPatterns("/tags/**")

                /*.excludePathPatterns("/diary/login")
                .excludePathPatterns("/swagger-ui/**")
                .excludePathPatterns("/swagger-ui.html/**")
                .excludePathPatterns("/v3/**")
                .excludePathPatterns("/project/**")*/;
    }
    
}
